package org.openzip.openzip.gui.util;

/**
 * Enumeration defining possible states of a three-state checkbox. Every state
 * defines its "selection" behaviour - whether is should be treated as
 * "selected" or "unselected" when a checkbox is asked about its selection state
 * by <code>isSelected()</code>.
 * 
 * @author Jakub Závěrka
 */
public enum State
{
	/**
	 * Defines a fully checked checkbox - selected.
	 */
	SELECTED(true),
	/**
	 * Defines an unchecked checkbox - not selected.
	 */
	NOT_SELECTED(false),
	/**
	 * Defines a state when a checkbox is nether selected nor unselected. For
	 * others its behaviour will be "selected".
	 */
	UNDECIDED(true);

	State(boolean b){
		selected = b;
	}

	private boolean selected;

	/**
	 * Defines the behaviour of each state towards classes that will treat
	 * <code>ThreestateCheckBox</code> as ordinary <code>JCheckBox</code>es.
	 * 
	 * @return Returns the value to return when <code>isSelected</code> is
	 *         called.
	 */
	public boolean isSelected(){
		return selected;
	}
}